package edu.sctu.wulixia.month6.day20150614;

import java.io.*;

/**
 * Created by user05 on 2015/6/14.
 */
public class IOStream {

    public void getFileInfo(){
        int countbyte = 0;
        FileInputStream fileInputStream;
        FileOutputStream fileOutputStream;
        byte [] buffer = new byte[1024];

        try {
            //将wlx.txt的内容复制到wwlx.txt再已字节形式输出

            fileInputStream = new FileInputStream(new File("D://nnn//wlx.txt"));
            fileOutputStream = new FileOutputStream(new File("D://nnn//wwlx.txt"));
            try{
                while ((countbyte = fileInputStream.read(buffer)) != -1){

                    fileOutputStream.write(buffer, 0, countbyte);

                    System.out.println(countbyte);
                }

            } catch (IOException e) {
                e.printStackTrace();
            }

            try{
                fileInputStream.close();
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}
